<template>
    <div class="view-oreder-box">
        <van-cell-group :border="false" v-for="data in dataResouce" :key="data.label">
            <div class="defaultRow" v-if="!(['附图', '附件', '发票下载', '受理通知书', '专属顾问', '代理人'].includes(data.label))">
                <van-field 
                :border="false"
                :value="data.value" 
                rows="1"
                type="textarea" 
                autosize
                :label="`${data.label}：`" disabled />
            </div>
            <div v-else-if="data.label === '专属顾问' || data.label === '代理人' ">
                <van-cell :border="false">
                    <template slot="icon">
                        <span class="custom-title" style="margin-right: 15px">{{data.label}}：</span>
                        {{data.label === '专属顾问' ? data.value && data.value.split('@')[0].slice(-3) : data.value}}
                        <van-icon @click="onChatBox(data.label)" v-if="isShowChat" style="margin-left: 15px" name="chat-o" size="22px" color="#2d8cf0"/>
                    </template>
                </van-cell>
            </div>
            <div class="downLoad" v-else>
                <van-cell :border="false">
                    <template slot="icon">
                        <span class="custom-title" style="margin-right: 15px">{{data.label}}：</span>
                        <a v-for="file in data.value && data.value.indexOf('&') ? data.value.split('&') : data.vaule " :key="file"
                        :href="`${baseUrls}/api/download?path=${file}`" >
                            <van-icon v-if="data.label === '附图'" name="photo-o" size="22px" color="#2d8cf0"/>
                            <van-icon v-else name="orders-o" size="22px" color="#2d8cf0"/>
                        </a>
                    </template>
                </van-cell>
            </div>
            
            <!-- 内容审核文件 -->
            <!-- <div class="auditFile">
                <van-cell :border="false">
                    <template slot="icon">
                        <span class="custom-title" style="margin-right: 15px; width: 150px">{{data.label}}：</span>
                        <div style="width: 100%">
                            <van-uploader 
                                v-if="downloadStatus.includes(data.status)" 
                                :after-read="afterRead" :accept="'doc/docx'" 
                                :max-count="5" multiple>
                                <template slot="default">
                                    <van-button type="primary" size="mini">上传文件</van-button>
                                </template>
                            </van-uploader>
                            <a v-for="file in data.review_file && data.review_file.indexOf('&') ? data.review_file.split('&') : data.review_file" :key="file"
                                :href="`${global.baseurl}/api/download?path=${file}`">
                                <van-icon name="orders-o" size="22px" color="#2d8cf0"/>
                            </a>
                        </div>
                    </template>
                </van-cell>
            </div> -->
		</van-cell-group>
    </div>
</template>

<script>
import getCurrentOrderList from '~/util/getCurrentOrderList'
export default {
    data() {
        return{
            baseUrls: global.baseurl,
        }
    },
    created() {
        // console.log({detail: this.dataResouce}, this.pageDataList, '12321312')
    },
    methods: {
        onChatBox(name) {
            console.log(name, 'name')
            this.$emit('onChat', name)
        }
    },
    watch: {
        // dataResouce: (data) => {
        //     if(data) {
        //         console.log(data, 'data')
        //     }
        // }
    },
    props: [
        'dataResouce', // 数据源
        'pageDataList', // 页面label静态信息
        'isShowChat'
    ]
}
</script>

<style lang="less" scoped>
    .view-oreder-box{
        /deep/ .van-field__label{
            width: auto;
        }
    }
</style>